﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace hm1_1
{
    

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void buttonMS_Click(object sender, EventArgs e)
        {
            Computer computer = new Computer();
            Lenovo lenovo = new Lenovo();   
            Huawei huawei = new Huawei();
            MessageBox.Show(computer.getComputerName() + lenovo.getComputerName() + huawei.getComputerName());
        }

        Stack<string> stack = new Stack<string>();
        Queue<string> queue = new Queue<string>();
        

        private void buttonPushStack_Click(object sender, EventArgs e)
        {
            try
            {
                stack.pushStack(textBox1.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void buttonPopStack_Click(object sender, EventArgs e)
        {            
            try
            {
                textBoxStack.Text = stack.popStack();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void buttonPushQueue_Click(object sender, EventArgs e)
        {
            try
            {
                queue.pushQueue(textBox1.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void buttonPopQueue_Click(object sender, EventArgs e)
        {
            try
            {
                textBoxQueue.Text = queue.popQueue();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
